package gx.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

import gx.entity.Category;

@Entity
@Table(name="t_product")
public class Product {
	@javax.persistence.Id
	@GeneratedValue
	private Integer Id;
	private String isbn;//
	private String model;
	private String name;
	private BigDecimal sale_price;//和采购价格不同哦
	private Integer security_num;
	private String summary;
	private String unit;
	private Date expir_date;
	private Integer expireTime;
	private Integer num;
	

	
	@ManyToOne 
	@JoinColumn(name="cate_id")
	private Category category;
//	//与库存表关联
//	@ManyToOne
//	@JoinColumn(name="store_id")
//	private Store store;
	
	
	@JsonIgnore
	@OneToMany(mappedBy="product")
	private List<Store> storeList=new ArrayList<>();
	
	
//	 商品到销售订单项的一对多
	@OneToMany(mappedBy = "product")
	@JsonIgnore
	private List<SaleItem> saleItemList = new ArrayList<SaleItem>();
	
//	public Date getExpir_date() {
//		return expir_date;
//	}
//	public Store getStore() {
//		return store;
//	}
//	public void setStore(Store store) {
//		this.store = store;
//	}
//	public List<SaleItem> getSaleItemList() {
//		return saleItemList;
//	}
//	public void setSaleItemList(List<SaleItem> saleItemList) {
//		this.saleItemList = saleItemList;
//	}
//	public void setExpir_date(Date expir_date) {
//		this.expir_date = expir_date;
//	}
	public Integer getId() {
		return Id;
	}
	public void setId(Integer id) {
		Id = id;
	}
	public String getIsbn() {
		return isbn;
	}
	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public BigDecimal getSale_price() {
		return sale_price;
	}
	public void setSale_price(BigDecimal sale_price) {
		this.sale_price = sale_price;
	}
	public Integer getSecurity_num() {
		return security_num;
	}
	public Date getExpir_date() {
		return expir_date;
	}
	public void setExpir_date(Date expir_date) {
		this.expir_date = expir_date;
	}
	
	
	public void setSecurity_num(Integer security_num) {
		this.security_num = security_num;
	}
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	public Category getCategory() {
		return category;
	}
	public String getModel() {
		return model;
	}
	public void setModel(String model) {
		this.model = model;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public List<SaleItem> getSaleItemList() {
		return saleItemList;
	}
	public void setSaleItemList(List<SaleItem> saleItemList) {
		this.saleItemList = saleItemList;
	}
	public Integer getNum() {
		return num;
	}
	public void setNum(Integer num) {
		this.num = num;
	}
	public Integer getExpireTime() {
		return expireTime;
	}
	public void setExpireTime(Integer expireTime) {
		this.expireTime = expireTime;
	}
	public List<Store> getStoreList() {
		return storeList;
	}
	public void setStoreList(List<Store> storeList) {
		this.storeList = storeList;
	}

}
